{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(584, 15) (146,)\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "from scipy.stats import pearsonr\n",
    "from sklearn.model_selection import train_test_split\n",
    "from sklearn.preprocessing import StandardScaler\n",
    "from sklearn.model_selection import GridSearchCV\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "import csv\n",
    "import time\n",
    "\n",
    "np.set_printoptions(precision=3, suppress=True)\n",
    "np.set_printoptions(formatter={'float': '{: 0.3f}'.format})\n",
    "\n",
    "with open('day.csv') as f:\n",
    "    reader = csv.reader(f)\n",
    "    train = np.array([row for row in reader])\n",
    "    heat = train[0]\n",
    "    train = train[1:-1]\n",
    "print(heat)\n",
    "temp = train[0,1]\n",
    "d = train[:,1]\n",
    "daeday = [ time.mktime(time.strptime(temp,'%Y-%m-%d')) for temp in d ]\n",
    "\n",
    "train[:,1] = daeday\n",
    "train = train.astype('float')\n",
    "y = train[:,-1]\n",
    "x = train[:,0:-1]\n",
    "scaler = StandardScaler()\n",
    "x = scaler.fit_transform(x)\n",
    "x_train , x_test,y_train,y_test = train_test_split(x,y,test_size = 0.2)\n",
    "print(x_train.shape,y_test.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
